home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
- +--------------+
- | |
- | |
- | C.C.D.F. |
- | |
- | |
- +--------------+
-
-
-
-
-
- A DOS Utility to
-
- Columnify Comma Delimited Files
-
-
-
-
-
- Copyright (C) 1994
-
-
- by
-
-
- Pinnacle Software
- CP386 Mount Royal
- QC Canada H3P 3C6
-
-
-
-
-
- Phone (514) 345-9578
- BBS (514) 345-8654
- CompuServe 70154,1577
-
-
-
-
-
- CCDF is distributed as Shareware: you may use CCDF free of charge, or
- distribute copies to others, with the proviso that CCDF may be used or
- distributed ONLY in its complete and unaltered form.
-
-
-
-
- ========================
- WHY C.C.D.F. WAS WRITTEN
- ========================
-
-
- A few days ago, I was astonished to discover that a well-known
- spreadsheet program was incapable of reading the familiar "comma-
- delimited" format. That is to say, it couldn't read an ordinary text
- file with the data fields broken up like this:
-
-
- +---------------------------------------------------------------------+
- | |
- | "CARRIER","ZIP",23809,"01-10-94" |
- | "DASI","ZIP",21083,"01-10-94" |
- | "FORAGE","ZIP",36867,"01-10-94" |
- | "FREE","ZIP",109669,"01-10-94" |
- | |
- | |
- | Fig. 1 -- Sample of comma-delimited data |
- +---------------------------------------------------------------------+
-
-
- In a comma-delimited file, character fields are enclosed in double
- quotation marks, while numeric data is presented as-is. Each field is
- delimited (i.e. separated) by a comma. The sample above (Fig. 1)
- represents the following four fields:
-
-
- +---------------------------------------------------------------------+
- | |
- | CARRIER ZIP 23809 01-10-94 |
- | DASI ZIP 21083 01-10-94 |
- | FORAGE ZIP 36867 01-10-94 |
- | FREE ZIP 109669 01-10-94 |
- | |
- | Fig. 2 -- Sample of columnar data |
- +---------------------------------------------------------------------+
-
-
- ... which just happens to be one of my directories. The content of the
- data is not the point, here; it's the FORMAT that concerns us.
-
-
- Many people exchange data in comma-delimited format, but some programs
- don't read it. Fortunately, some programs that will not read comma-
- delimited data WILL read columnar data (i.e. data arranged in columns,
- as in Fig. 2). That's where CCDF comes in...
-
-
-
- ================
- INTRODUCING CCDF
- ================
-
-
- CCDF ("Columnify Comma-Delimited Files") will read a comma-delimited
- text file and output the fields in columns. The format of the command
- is as follows:
-
- CCDF input-file output-file
-
- For example, to process the comma-delimited file MYFILE.TXT and send
- the result to a text file named OUTPUT.TXT, you would enter this
- command at the DOS prompt:
-
- CCDF MYFILE.TXT OUTPUT.TXT
-
- This simple command will do the following:
-
- -- Read each line from MYFILE.TXT
- -- Remove commas
- -- Remove leading and trailing double-quotes for each field
- -- Format the data into columns 20 characters wide
- -- Write each new line to OUTPUT.TXT.
-
- You can select a different column width by specifying a third parameter
- on the command line, as in this example:
-
- CCDF C:\ZAPHOD\MARVIN.TXT ARTHUR.TXT 30
-
- This would read the comma-delimited file MARVIN.TXT (in the ZAPHOD
- directory of drive C:) and output the result into 30-character wide
- columns in the file ARTHUR.TXT.
-
- If an input field is longer than the specified column width, it is
- truncated (i.e. chopped off) to fit.
-
-
-
- ===========
- LIMITATIONS
- ===========
-
-
- Alas, CCDF can not read input lines longer than 255 characters. If you
- want more than that, you can either break up the lines manually, using a
- macro editor, or pay me to write Version 2.00 of this product.
-
-
-
- ============
- RETURN CODES
- ============
-
-
- If you are using CCDF in a batch (.BAT) file, you can check it for
- successful operation by using the IF ERRORLEVEL function. CCDF returns
- an errorlevel of 0 (zero) if it worked, or 255 if it didn't.
-
-
- IMPORTANT: Remember that the IF ERRORLEVEL statement checks the
- indicated level AND HIGHER, so don't use IF ERRORLEVEL 0,
- because it will always be true. Check the highest
- errorlevel first.
-
-
- Here is an example of how to use CCDF in a batch file, along with some
- explanatory comments:
-
-
- +---------------------------------------------------------------------+
- | |
- | @ECHO OFF <-- Turn off batch file echoing |
- | CCDF INPUT.TXT OUTPUT.TXT 50 <-- Run the CCDF command |
- | IF ERRORLEVEL 255 GOTO OOPS <-- Jump ahead if there was an error |
- | SEE OUTPUT.TXT <-- Use SEE to view output (Note 1) |
- | GOTO QUIT <-- Jump ahead to the end |
- | :OOPS <-- A batch file label |
- | ECHO Something didn't work! <-- Report the error |
- | :QUIT <-- A batch file label |
- | ECHO Finished! <-- Report the end of the file |
- | |
- | Fig. 3 -- Sample batch file using CCDF |
- +---------------------------------------------------------------------+
-
-
- NOTE 1: The SEE file viewer/printer can be downloaded from
- Pinnacle Software's free files BBS at 514-345-8654.
- It is a freeware program, so you can use it for this
- and other projects without paying a license fee.
-
-
-
- ===================
- GOING THE OTHER WAY
- ===================
-
-
- CCDF can convert comma-delimited data to columnar, but what if you have
- a columnar report (dumped to a text file) that you want converted to
- comma-delimited format? Fret not. There's a convenient shareware
- program named Parse-O-Matic (also by Pinnacle Software), which you can
- download from our free files BBS at 514-345-8654.
-
- A lot of people have saved a LOT of money by using Parse-O-Matic,
- because it lets them transfer data from one program to another without
- retyping.
-
- Incidentally, the Parse-O-Matic package includes the SEE utility
- mentioned in Fig. 3.
-
-
-
- ====================
- WATCH CCDF IN ACTION
- ====================
-
-
- The CCDF package contains a batch file, named CCDFDEMO.BAT, which
- processes the file CCDFDEMO.DTA -- also included in the package. To
- run the demo, enter this at the DOS prompt:
-
- CCDFDEMO
-
- This will display the input, run CCDF, then show the output.
-
-
-
- =========
- THANK-YOU
- =========
-
-
- Thank-you for taking the time to try out CCDF. It's yours to use, free
- of charge. If you wish, you can pass along a copy to a friend or
- associate. However, bear in mind the following legal notice:
-
-
- +---------------------------------------------------------------------+
- | |
- | YOU ARE ENTITLED TO USE CCDF v1.00 WITHOUT CHARGE PROVIDED YOU |
- | INSTALL THE PRODUCT ON YOUR SYSTEM IN ITS ENTIRETY, WHICH IS TO |
- | SAY THE FOLLOWING FILES: |
- | |
- | READ.ME CCDF.DOC CCDF.EXE CCDFDEMO.BAT CCDFDEMO.DTA |
- | AMAZE.DOC ORDER.FRM FILE_ID.DIZ VENDOR.DOC |
- | |
- | YOU MAY ALSO GIVE COMPLETE AND UNALTERED COPIES WITH OTHERS AND |
- | MAY CHARGE A SMALL FEE (NOT TO EXCEED U.S. $9) TO COVER YOUR |
- | DUPLICATION AND/OR TRANSMISSION COSTS. UNDER NO CIRCUMSTANCES |
- | MAY YOU DISTRIBUTE ALTERED OR INCOMPLETE COPIES OF THIS PRODUCT. |
- | |
- | |
- | Fig. 4 -- Surly yet important legal notice about CCDF |
- +---------------------------------------------------------------------+
-
-
- Whew. If you are interested in some of Pinnacle Software's other
- products, we have a special offer, which is explained in the text file
- AMAZE.DOC. To print it out, enter this command at the DOS prompt:
-
- TYPE AMAZE.DOC >PRN
-
- If you like what you see there, you can print out the order form with
- this command:
-
- TYPE ORDER.FRM >PRN
-
- If you have any comments about CCDF, please let me know. My name is
- Tim, and you can reach me at 514-345-9578, or at CompuServe 70154,1577.
-
-
-
-